package hottargui.domain.blitz;



import hottargui.domain.*;

public class BlitzEndRoundStrategyImpl implements EndRoundStrategy {

	private DeckOfCards _deck;
	private StateMachine _sm; 



	public BlitzEndRoundStrategyImpl(StateMachine sm, DeckOfCards deck){
		_deck = deck;
		_sm = sm;
	}

	public State calculateEndOfRound() {

		_deck.takeCardFormTopOfDeck();
		_sm.doUpdateDeck(_deck);

		if (_deck.countCardsInDeck()==0) {
			return State.endRound;
		}
		else	{		  
			//System.out.println("Antal cards i deck " + _deck.countCardsInDeck() );
			return State.endTurn;

		}  
	}




	public boolean diceRollAllowed() {
		if (_deck.countCardsInDeck()==0)
			return true;
		else
			return false;
	}


	public void doUpdateDeck(DeckOfCards deck) {
		_deck = deck;  
	}


	public void setDeckOfCards(DeckOfCards deck) {
		_deck = deck;	
	}


}